package jp.anago_dev.takarush_helper.ui.actionbar;

import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.view.Menu;
import android.view.MenuInflater;

/**
 * ActionBarを構築するPreferenceActivityです。<br/> {@link ModernMapActivity}と同様の実装を行っています。
 * 
 * @author anago_dev
 * 
 */
public class ModernPreferenceActivity extends PreferenceActivity {

    /** ActionBar */
    private final ActionBarHelper mActionBarHelper = ActionBarHelper.createInstance(this);

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        mActionBarHelper.onCreate(savedInstanceState);
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void onPostCreate(Bundle savedInstanceState) {
        mActionBarHelper.onPostCreate(savedInstanceState);
        super.onPostCreate(savedInstanceState);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        boolean retValue = false;
        retValue |= mActionBarHelper.onCreateOptionsMenu(menu);
        retValue |= super.onCreateOptionsMenu(menu);
        return retValue;
    }

    @Override
    protected void onTitleChanged(CharSequence title, int color) {
        mActionBarHelper.onTitleChanged(title, color);
        super.onTitleChanged(title, color);

    }

    @Override
    public MenuInflater getMenuInflater() {
        return mActionBarHelper.getMenuInflater(super.getMenuInflater());
    }

    /**
     * Returns the {@link ActionBarHelper} for this activity.
     */
    protected ActionBarHelper getActionBarHelper() {
        return mActionBarHelper;
    }

}
